/*
  Copyright 2011 The Rhizosphere Authors. All Rights Reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

package com.rhizospherejs.gwt.client.renderer;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * Interface for {@link com.rhizospherejs.gwt.client.RhizosphereRenderer}
 * instances to declare whether a legend should be added to the visualization
 * to explain renderings attributes.
 *
 * @deprecated This interface is the porting of equivalent functionality in the
 *     Rhizosphere javascript library that is scheduled for rewrite
 *     (http://code.google.com/p/rhizosphere/issues/detail?id=120). It is
 *     likely to change significantly.
 * @author battlehorse@google.com (Riccardo Govoni)
 */
@Deprecated
public interface HasLegend {

  /**
   * @deprecated
   */
  @Deprecated
  public static class Range {
    public double min;
    public double max;
    public String label;

    public Range(String label, double min, double max) {
      this.label = label;
      this.min = min;
      this.max = max;
    }

    public JavaScriptObject toJavaScriptObject() {
      return nativeJavaScriptObject(label, min, max);
    }

    private native JavaScriptObject nativeJavaScriptObject(
        String label, double min, double max) /*-{
      return {
        min: min,
        max: max,
        label: label
      };
    }-*/;
  }

  /**
   * If the renderer uses a font size scale to visually represent a numerical
   * attribute, returns a descriptor for such scale, otherwise return
   * {@code null}.
   */  
  public Range getSizeRange();

  /**
   * If the renderer uses a color scale to visually represent a numerical
   * attribute, returns a descriptor for such scale, otherwise return
   * {@code null}.
   */
  public Range getColorRange();

}
